﻿<?php require_once('Connections/edireal.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_edireal, $edireal);
$query_country = "SELECT * FROM country";
$country = mysql_query($query_country, $edireal) or die(mysql_error());
$row_country = mysql_fetch_assoc($country);
$totalRows_country = mysql_num_rows($country);

mysql_select_db($database_edireal, $edireal);
$query_Recordset1 = "SELECT full_info FROM offer WHERE id = 80120102";
$Recordset1 = mysql_query($query_Recordset1, $edireal) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iframe</title>
</head>

<body>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<form id="form1" name="form1" method="post" action="">
  <table width="100%" border="0">
    <tr>
      <td>&nbsp;</td>
      <td width="10"><label for="country"></label>
        <select name="country" id="country">
          <?php
do {  
?>
          <option value="<?php echo $row_country['id']?>"<?php if (!(strcmp($row_country['id'], 2))) {echo "selected=\"selected\"";} ?>><?php echo $row_country['name_country']?></option>
          <?php
} while ($row_country = mysql_fetch_assoc($country));
  $rows = mysql_num_rows($country);
  if($rows > 0) {
      mysql_data_seek($country, 0);
	  $row_country = mysql_fetch_assoc($country);
  }
?>
        </select></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
     <div id="out_table_1"></div>
    </tr>
  </table>
  <input name="" type="submit" value="Отправить" />
</form>

<script>
$('#country').change(function(){
 var objCountry = document.getElementById("country");
 $.post('index_select_country.php', {param: objCountry.options[objCountry.selectedIndex].value}, function(data){
  $('#out_table_1').html(data);
 });
});
</script>
</body>
</html>
<?php
mysql_free_result($country);

mysql_free_result($Recordset1);
?>
